<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>view/workArea/others/updateCase</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../../../css/mui.min.css">
		<link rel="stylesheet" href="../../../css/global.css">
		<link rel="stylesheet" href="../../../css/style.css">
		<link href="../../../css/task.css" rel="stylesheet" />
		<style type="text/css">
			.d_int_tp{
				border: 0 !important;
				margin-top: 6px !important;
			}
			.select-tzstate{
				width: 100%;
				border: 0;
				color: #a9a9a9;
				font-size: 16px;
				text-align: left;
				padding: 15px;
			}
			.mui-bar-nav{
				box-shadow: 0 1px 6px #ea1e1a;
			}
			
			.details_con .btm .selectBtn {
			    line-height: 28px;
			    color: #ffffff;
			    background: #ea1e1a;
			}
			.item_box .item .type{
				padding: 0 20px 10px;
				overflow: hidden;
			}
			.item_box .item .type p{
				overflow: hidden;
			}
			.item_box .item .type span{
				word-wrap: break-word;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">升级case管理</h1>
		</header>
		
		<div class="mui-content">
			<div class="details_con select_con">
				<div class="clum">
					<input type="text" class="d_int_tp" id="serviceNo" placeholder="请输入服务通知编号" />
				</div>
				<div class="clum">
					<input type="text" class="d_int_tp" id="customerName" placeholder="请输入客户名称" />
				</div>
				<div class="clum">
					<input type="text" class="d_int_tp" id="createTime" readonly="readonly" placeholder="请选择申请时间" style="background: #ea1e1a;border: 0"/>
				</div>
				<div class="btm autoHeight">
					<p class="selectBtn" onclick="search()">查询</p>
				</div>
			</div>
			<div class="details_con" style="margin: 30px 0 0 0;">
				<div class="item_box" id="contentList">
					
					<!-- <div class="item" onclick="">
						<p class="bar"><span class="number">1170001</span></p>
						<div class="name">
							<span class="time">2020-01-17 10:25</span>
							申请时间
						</div>
						<div class="type">
							<p class="icon1">状态：<span>安装</span></p>
							<p class="icon2">变更信息：<span>更改仪器序列号</span></p>
							<p class="icon2">关闭时间：<span>2020-01-20</span></p>
						</div>
					</div> -->
					
				</div>
				
			</div>
		</div>

		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->
		<script src="../../../js/utils/rolldate.min.js"></script>

		<script type="text/javascript" charset="utf-8">
			(function($, doc) {
				$.init();
				$.plusReady(function() {
					
					new Rolldate({
						el: '#createTime',
						format: 'YYYY-MM-DD',
						beginYear: 2015,
						endYear: 2050,
						trigger: 'click',
						lang: {
							title: '请选择申请时间',
						},
						confirm: function(date) {
							// jisuan(date)
						},
						cancel: function() {
						   h('#createTime').val("");
						}
					})
					
					// search(); //查询数据
				});
			}(mui, document));
			
			// 搜索事件,获取搜索关键词
			function enterSearch(event){
				if(event.keyCode == 13) {//用户点击回车的事件号为13
					search(); //查询数据
				}
			}

			// 查询数据
			function search() {
				var enginnerId = app.getUser().enginnerId;
				var serviceNo = h("#serviceNo").val();
				var customerName = h("#customerName").val();
				var createTime = h("#createTime").val();
				app.showWaiting('加载中...')
				ajaxPost(BASE_URL + "cc/planAndCase/caseList", {
					"serviceNo": serviceNo,
					"enginnerId" : enginnerId,
					"customerName" : customerName,
					"createTime" : createTime
				}, function(data) {
					app.closeWaiting()
					if (data.code == 200) {//查询成功
						var arr = data.data;
						// 无数据
						if (arr.length == 0) {
							h("#contentList").html('<div class="nodata">—— 暂无数据 ——</div>');
							return false;
						}
						// 显示列表
						var html = "";
						for (var i = 0; i < arr.length; i++) {
							// var info = data.data[i];
							html += '<div class="item" onclick="jumpToNext(\''+ arr[i].serviceNo +'\', \''+ arr[i].enginnerId +'\', \''+ arr[i].requestId +'\')">';
							html += '<div class="bar">';
							html += '<span class="number"><img src="../../../images/icon_204.png" />' + arr[i].serviceNo + '</span>';
							var userTypeName = "";
							var enginnerType = arr[i].enginnerType ? arr[i].enginnerType : "";
							var isVip = arr[i].isVip ? arr[i].isVip : "";
							var userIsdpel = arr[i].userIsdpel ? arr[i].userIsdpel : "";
							if (userIsdpel == '1') {
								userTypeName = 'DPEL/';
							} 
							if(isVip != ""){
								userTypeName += isVip;
							}else{
								if(enginnerType != ""){
									userTypeName += enginnerType;
								}
							}
							html += '<span class="vip">'+ userTypeName +'</span>';
							html += '</div>';
							html += '<div class="type">';
							html += '<p><img src="../../../images/icon_202.png" /><span class="lpl fl" style="width:80px;">申请时间：</span><span>'+ arr[i].createTime +'</span></p>';
							var stat = arr[i].status == 1 ? "已关闭" : "处理中";
							html += '<p><img src="../../../images/icon_205.png" /><span class="lpl fl" style="width:80px;">状态：</span><span>'+ stat +'</span></p>';
							html += '<p><img src="../../../images/icon_224.png" /><span class="lpl fl" style="width:80px;">变更信息：</span><span>'+ arr[i].remarks +'</span></p>';
							if (arr[i].updateTime) {
								html += '<p><img src="../../../images/icon_202.png" /><span class="lpl fl" style="width:80px;">关闭时间：</span><span>'+ arr[i].updateTime +'</span></p>';
							} else {
								html += '<p><img src="../../../images/icon_202.png" /><span class="lpl fl" style="width:80px;">关闭时间：</span><span></span></p>';
							}
							html += '</div></div>';
						}
						h("#contentList").html(html);
					} else {//查询失败
						h("#contentList").html('<div class="nodata">—— 暂无数据 ——</div>');
						app.toast(data.msg);
					}
				}, function(errorMsg) {
					app.closeWaiting()
					h("#contentList").html('<div class="nodata">—— 暂无数据 ——</div>');
					app.toast("数据获取失败，请检查网络连接");
				});
			}
			
			// 跳转下一页
			function jumpToNext(serviceNo, enginnerId, requestId) {
				app.jumpTo("/view/workArea/service/serveDetails.html", "view/workArea/service/serveDetails", {
					serviceNo : serviceNo,
					enginnerId : enginnerId,
					prev : "updateCase"
				});
			}
		</script>
		<!-- js代码 end -->

	</body>

</html>
